import defaultState from '../state/goods'
import { fromJS } from 'immutable'

const reducer = (state = defaultState, action) => {
  const type = action.type
  const data = action.data || ''

  switch (type) {
    case 'goodssort':
      let newState = state.set('goodsSort', fromJS(data))
      return newState
    case 'goodslist':
      let newList = state.set('goodsList' , fromJS(data))
      return newList
    default:
      return state
  }
}

export default reducer